package cn.cdut.yiwenqian.biz.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.cdut.yiwenqian.biz.interfaces.IUserManager;
import cn.cdut.yiwenqian.dao.interfaces.IUserDao;
import cn.cdut.yiwenqian.entity.CdutPostUsers;
@Service
@Transactional
public class UserManagerImpl implements IUserManager {

	@Autowired
	private IUserDao userDao;
	@Override
	public CdutPostUsers findUserById(Integer id) {
		return userDao.findUserById(id);
	}
	@Override
	public CdutPostUsers loginByAccountAndPassword(String account, String pass) {
		return userDao.findUserByAccountPassWord(account, pass);
	}
	@Override
	public List<CdutPostUsers> findUserByAccount(String account) {
		return userDao.fingUserListByAccount(account);
	}
	@Override
	public void regestByAccountAndPass(CdutPostUsers user) {
		userDao.saveNweUser(user);
		
	}
	@Override
	public CdutPostUsers updateUserInfo(CdutPostUsers user) {
		userDao.updateUser(user);
		return userDao.findUserById(user.getUnumber());
	}

}
